using System;
using System.Drawing;
using MonoTouch.Foundation;
using MonoTouch.CoreGraphics;
using MonoTouch.UIKit;
using MonoTouch.ObjCRuntime;

namespace Cocos2D
{
	#region MenuItemLabel
	
	[BaseType(typeof(MenuItem), Name="CCMenuItemLabel")]
	interface MenuItemLabel
	{
		#region Static methods
		
		[Static, Export("itemWithLabel:target:selector:")]
		[Internal]
		MenuItemLabel ItemWithLabel(Node label, NSObject target, Selector sel);
		
		#endregion
		
		#region Properties
		
		[Export("disabledColor")]
		Color3B DisabledColor
		{
			get;
			set;
		}
		
		[Export("label", ArgumentSemantic.Retain)]
		Node Label
		{
			get;
			set;
		}
		
		#endregion
		
		#region Constructors
		
		[Export("initWithLabel:target:selector:")]
		[Internal]
		IntPtr Constructor(Node label, NSObject target, Selector sel);
		
		#endregion
		
		#region Instance methods
		
		[Export("setString:")]
		void SetString(string label);
		
		[Export("setIsEnabled:")]
		void SetIsEnabled(bool enabled);
		
		#endregion
	}
	
	#endregion
	
	#region MenuItemFont
	
	[BaseType(typeof(MenuItemLabel), Name="CCMenuItemFont")]
	interface MenuItemFont
	{
		#region Static methods
		
		[Static, Export("fontSize")]
		int FontSize
		{
			get;
			set;
		}
		
		[Static, Export("fontName", ArgumentSemantic.Assign)]
		string FontName
		{
			get;
			[NullAllowed] set;
		}
		
		[Static, Export("itemFromString:")]
		MenuItemFont ItemFromString( [NullAllowed] string v);
		
		[Static, Export("itemFromString:target:selector:")]
		MenuItemFont ItemFromString( [NullAllowed] string v, [NullAllowed] NSObject target, [NullAllowed] Selector sel);
		
		#endregion
		
		#region Constructors
		
		[Export("initFromString:target:selector:")]
		IntPtr Constructor( [NullAllowed] string v, [NullAllowed] NSObject target, [NullAllowed] Selector sel);
		
		#endregion
	}
	
	#endregion
	
	#region Menu
	
	[BaseType(typeof(Layer), Name="CCMenu")]
	interface Menu
	{
		#region Static methods
		
		[Static, Export("menuWithItems:")]
		[Internal] // we don't ever really call this...
		Menu MenuWithItems( [NullAllowed] IntPtr items);
		
		#endregion
		
		#region Properties
		
		[Export("opacity")]
		byte Opacity
		{
			get;
		}
		
		[Export("color")]
		Color3B Color
		{
			get;
		}
		
		#endregion
		
		#region Constructors
		
		[Export("initWithItems:vaList:")]
		[Internal]
		IntPtr Constructor( [NullAllowed] MenuItem item, [NullAllowed] IntPtr args);
		
		#endregion
		
		#region Instance methods
		
		[Export("alignItemsVertically")]
		void AlignItemsVertically();
		
		[Export("alignItemsVerticallyWithPadding:")]
		void AlignItemsVerticallyWithPadding(float padding);
		
		[Export("alignItemsHorizontally")]
		void AlignItemsHorizontally();
		
		[Export("alignItemsHorizontally")]
		void AlignItemsHorizontallyWithPadding(float padding);
		
		[Export("alignItemsInColumns:")]
		void AlignItemsInColumns(params NSNumber[] columns);
		
		[Export("alignItemsInRows:")]
		void AlignItemsInRows(params NSNumber[] rows);
		
		#endregion
	}
	
	#endregion
	
	#region MenuItem
	
	[BaseType(typeof(Node), Name="CCMenuItem")]
	interface MenuItem
	{
		#region Static methods
		
		[Static, Export("itemWithTarget:selector:")]
		MenuItem ItemWithTarget( [NullAllowed] NSObject target, [NullAllowed] Selector selector);
		
		#endregion
		
		#region Properties
		
		[Export("isSelected")]
		bool IsSelected
		{
			get;
		}
		
		#endregion
		
		#region Constructors
		
		[Export("initWithTarget:selector:")]
		IntPtr Constructor( [NullAllowed] NSObject target, [NullAllowed] Selector selector);
		
		#endregion
		
		#region Instance methods
		
		[Export("rect")]
		RectangleF Rect
		{
			get;
		}
		
		[Export("activate")]
		void Activate();
		
		[Export("selected")]
		void Selected();
		
		[Export("unselected")]
		void Unselected();
		
		[Export("isEnabled")]
		bool IsEnabled
		{
			get;
			set;
		}
		
		#endregion
	}
	
	#endregion*/
	
	#region Texture2D
	
	[BaseType(typeof(NSObject), Name="CCTexture2D")]
	interface Texture2D
	{
		#region Static methods
		
		[Static, Export("defaultAlphaPixelFormat")]
		Texture2DPixelFormat DefaultAlphaPixelFormat
		{
			get;
			set;
		}
		
		#endregion
		
		#region Properties
		
		[Export("pixelFormat")]
		Texture2DPixelFormat PixelFormat
		{
			get;
		}
		
		[Export("pixelsWide")]
		uint PixelsWide
		{
			get;
		}
		
		[Export("pixelsHigh")]
		uint PixelsHigh
		{
			get;
		}
		
		[Export("name")]
		uint Name
		{
			get;
		}
		
		[Export("contentSize")]
		SizeF ContentSize
		{
			get;
		}
		
		[Export("maxS")]
		float MaxS
		{
			get;
			set;
		}
		
		[Export("maxT")]
		float MaxT
		{
			get;
			set;
		}
		
		[Export("hasPremultipliedAlpha")]
		bool hasPremultipliedAlpha
		{
			get;
		}
		
		#endregion
		
		#region Constructors
		
		[Export("initWithData:pixelFormat:pixelsWide:pixelsHigh:contentSize:")]
		IntPtr Constructor( [NullAllowed] IntPtr data, Texture2DPixelFormat pixelFormat, uint width, uint height, SizeF size);
		
		[Export("initWithImage:")]
		IntPtr Constructor( [NullAllowed] UIImage uiImage);
		
		[Export("initWithString:dimensions:alignment:fontName:fontSize:")]
		IntPtr Constructor(string str, SizeF dimensions, UITextAlignment textAlignment, string fontName, float size);
		
		[Export("initWithString:fontName:fontSize:")]
		IntPtr Constructor(string str, string fontName, float size);
		
		[Export("initWithPVRTCData:level:bpp:hasAlpha:length:")]
		IntPtr Constructor( [NullAllowed] IntPtr data, int level, int bpp, bool hasAlpha, int length);
		
		[Export("initWithPVRTCFile:")]
		IntPtr Constructor(string file);
		
		#endregion
		
		#region Instance methods
		
		[Export("drawAtPoint:")]
		void DrawAtPoint(PointF point);
		
		[Export("drawInRect:")]
		void DrawInRect(RectangleF rect);
		
		[Export("setTexParameters:")]
		[Internal]
		void SetTexParameters( [NullAllowed] IntPtr texParams);
		
		[Export("setAntiAliasTexParameters")]
		void SetAntiAliasTexParameters();
		
		[Export("setAliasTexParameters")]
		void SetAliasTexParameters();
		
		[Export("generateMipmap")]
		void GenerateMipmap();
		
		#endregion
	}
	
	#endregion
	
	#region Grabber
	
	[BaseType(typeof(NSObject), Name="CCGrabber")]
	interface Grabber
	{
		[Export("grab:")]
		void Grab( [NullAllowed] Texture2D texture);
		
		[Export("beforeRender:")]
		void BeforeRender( [NullAllowed] Texture2D texture);
		
		[Export("afterRender:")]
		void AfterRender( [NullAllowed] Texture2D texture);
	}
	
	#endregion
	
	#region Action
	
	[BaseType(typeof(NSObject), Name="CCAction")]
	interface Action
	{
		#region Properties
		
		[NullAllowed, Export("target", ArgumentSemantic.Assign)]
		NSObject Target
		{
			get;
			set;
		}
		
		[NullAllowed, Export("originalTarget", ArgumentSemantic.Assign)]
		NSObject OriginalTarget
		{
			get;
			set;
		}
		
		[Export("tag", ArgumentSemantic.Assign)]
		int Tag
		{
			get;
			set;
		}
		
		#endregion
		
		#region Static methods
		
		// TODO:
		// WhateverAction.Action returns an instance of Action instead of
		// WhateverAction
		/*
		[Static, Export("action")]
		Action Action
		{
			get;
		}*/
		
		#endregion
		
		#region Instance methods
		
		[Export("isDone")]
		bool IsDone
		{
			get;
		}
		
		[Export("startWithTarget:")]
		void StartWithTarget( [NullAllowed] NSObject target);
		
		[Export("stop")]
		void Stop();
		
		[Export("step:")]
		void Step(float dt);
		
		[Export("update:")]
		void Update(float dt);
		
		#endregion
	}
	
	#endregion
	
	#region FiniteTimeAction
	
	[BaseType(typeof(Action), Name="CCFiniteTimeAction")]
	interface FiniteTimeAction
	{
		[Export("duration")]
		float Duration
		{
			get;
			set;
		}
		
		[Export("reverse")]
		FiniteTimeAction Reverse
		{
			get;
		}
	}
	
	#endregion
	
	#region GridBase
	
	[BaseType(typeof(NSObject), Name="CCGridBase")]
	interface GridBase
	{
		#region Properties
		
		[Export("active")]
		bool Active
		{
			get;
			set;
		}
		
		[Export("reuseGrid")]
		int ReuseGrid
		{
			get;
			set;
		}
		
		[Export("gridSize")]
		GridSize GridSize
		{
			get;
			set;
		}
		
		[Export("step")]
		PointF Step
		{
			get;
			set;
		}
		
		[NullAllowed, Export("texture", ArgumentSemantic.Retain)]
		Texture2D Texture
		{
			get;
			set;
		}
		
		[NullAllowed, Export("grabber", ArgumentSemantic.Retain)]
		Grabber Grabber
		{
			get;
			set;
		}
		
		#endregion
		
		#region Constructors
		
		[Export("initWithSize:")]
		IntPtr Constructor(GridSize gridSize);
		
		#endregion
		
		#region Instance methods
		
		[Export("beforeDraw")]
		void BeforeDraw();
		
		[Export("afterDraw:")]
		void AfterDraw( [NullAllowed] Camera camera);
		
		[Export("blit")]
		void Blit();
		
		[Export("reuse")]
		void Reuse();
		
		#endregion
	}
	
	#endregion
	
	#region Grid3D
	
	[BaseType(typeof(GridBase), Name="CCGrid3D")]
	interface Grid3D
	{
		#region Static methods
		
		[Static, Export("gridWithSize:")]
		GridBase GridWithSize(GridSize size);
		
		#endregion
		
		#region Constructors
		
		[Export("initWithSize:")]
		IntPtr Constructor(GridSize gridSize);
		
		#endregion
		
		#region Instance methods
		
		[Export("vertex:")]
		Vertex3F Vertex(GridSize pos);
		
		[Export("originalVertex:")]
		Vertex3F OriginalVertex(GridSize pos);
		
		[Export("setVertex:vertex:")]
		void SetVertex(GridSize pos, Vertex3F vertex);
		
		[Export("calculateVertexPoints")]
		void CalculateVertexPoints();
		
		#endregion
	}
	
	#endregion
	
	#region TiledGrid3D
	
	[BaseType(typeof(GridBase), Name="CCTiledGrid3D")]
	interface TiledGrid3D
	{
		#region Static methods
		
		[Static, Export("gridWithSize:")]
		GridBase GridWithSize(GridSize gridSize);
		
		#endregion
		
		#region Constructors
		
		[Export("initWithSize:")]
		IntPtr Constructor(GridSize gridSize);
		
		#endregion
		
		#region Instance methods
		
		[Export("tile:")]
		Quad3 Tile(GridSize pos);
		
		[Export("originalTile:")]
		Quad3 OriginalTile(GridSize pos);
		
		[Export("setTile:coords:")]
		void SetTile(GridSize pos, Quad3 coords);
		
		[Export("calculateVertexPoints")]
		void CalculateVertexPoints();
		
		#endregion
	}
	
	#endregion
	
	#region Camera
	
	[BaseType(typeof(NSObject), Name="CCCamera")]
	interface Camera
	{
		#region Properties
		
		[Export("dirty")]
		bool Dirty
		{
			get;
			set;
		}
		
		#endregion
		
		#region Static methods
		
		[Static, Export("getZEye")]
		float ZEye
		{
			get;
		}
		
		#endregion
		
		#region Instance methods
		
		[Export("restore")]
		void Restore();
		
		[Export("locate")]
		void Locate();
		
		[Export("setEyeX:eyeY:eyeZ:")]
		void SetEye(float x, float y, float z);
		
		[Export("setUpX:upY:upZ:")]
		void SetUp(float x, float y, float z);
		
		[Export("eyeX:eyeY:eyeZ:")]
		[Internal]
		void GetEye( [NullAllowed] IntPtr x, [NullAllowed] IntPtr y, [NullAllowed] IntPtr z);
		
		[Export("centerX:centerY:centerZ:")]
		[Internal]
		void GetCenter( [NullAllowed] IntPtr x, [NullAllowed] IntPtr y, [NullAllowed] IntPtr z);
		
		[Export("upX:upY:upZ:")]
		[Internal]
		void GetUp( [NullAllowed] IntPtr x, [NullAllowed] IntPtr y, [NullAllowed] IntPtr z);
		
		#endregion
	}
	
	#endregion
	
	#region Sprite
	
	[BaseType(typeof(Node), Name="CCSprite")]
	interface Sprite
	{
		#region Static methods
		
		[Static, Export("spriteWithTexture:")]
		Sprite SpriteWithTexture( [NullAllowed] Texture2D texture);
		
		[Static, Export("spriteWithTexture:rect:")]
		Sprite SpriteWithTexture( [NullAllowed] Texture2D texture, RectangleF rect);
		
		[Static, Export("spriteWithTexture:rect:offset:")]
		Sprite SpriteWithTexture( [NullAllowed] Texture2D texture, RectangleF rect, PointF offset);
		
		[Static, Export("spriteWithSpriteFrame:")]
		Sprite SpriteWithSpriteFrame( [NullAllowed] SpriteFrame spriteFrame);
		
		[Static, Export("spriteWithSpriteFrameName:")]
		Sprite SpriteWithSpriteFrameName( [NullAllowed] string spriteFrameName);
		
		[Static, Export("spriteWithFile:")]
		Sprite SpriteWithFile( [NullAllowed] string filename);
		
		[Static, Export("spriteWithFile:rect:")]
		Sprite SpriteWithFile( [NullAllowed] string filename, RectangleF rect);
		
		[Static, Export("spriteWithCGImage:")]
		Sprite SpriteWithCGImage( [NullAllowed] CGImage image);
		
		#endregion
		
		#region Properties
		
		[Export("dirty")]
		bool Dirty
		{
			get;
			set;
		}
		
		[Export("quad")]
		V3F_C4B_T2F_Quad Quad
		{
			get;
		}
		
		[Export("atlasIndex")]
		uint AtlasIndex
		{
			get;
			set;
		}
		
		[Export("textureRect")]
		RectangleF TextureRect
		{
			get;
		}
		
		[Export("flipX")]
		bool FlipX
		{
			get;
			set;
		}
		
		[Export("flipY")]
		bool FlipY
		{
			get;
			set;
		}
		
		[Export("opacity")]
		byte Opacity
		{
			get;
		}
		
		[Export("color")]
		Color3B Color
		{
			get;
		}
		
		[Export("usesSpriteSheet")]
		bool UsesSpriteSheet
		{
			get;
			set;
		}
		
		[NullAllowed, Export("textureAtlas", ArgumentSemantic.Assign)]
		TextureAtlas TextureAtlas
		{
			get;
			set;
		}
		
		[NullAllowed, Export("spriteSheet", ArgumentSemantic.Assign)]
		SpriteSheet SpriteSheet
		{
			get;
			set;
		}
		
		[Export("honorParentTransform")]
		HonorParentTransform HonorParentTransform
		{
			get;
			set;
		}
		
		[Export("offsetPosition")]
		PointF OffsetPosition
		{
			get;
			set;
		}
		
		[Export("blendFunc")]
		BlendFunc BlendFunc
		{
			get;
			set;
		}
		
		#endregion
		
		#region Constructors
		
		[Export("initWithTexture:")]
		IntPtr Constructor( [NullAllowed] Texture2D texture);
		
		[Export("initWithTexture:rect:")]
		IntPtr Constructor( [NullAllowed] Texture2D texture, RectangleF rect);
		
		[Export("initWithSpriteFrame:")]
		IntPtr Constructor( [NullAllowed] SpriteFrame spriteFrame);
		
		// TODO: Conflicts with constructor below
		//[Export("initWithSpriteFrameName:")]
		//IntPtr Constructor(string spriteFrameName);
		
		[Export("initWithFile:")]
		IntPtr Constructor( [NullAllowed] string filename);
		
		[Export("initWithFile:rect:")]
		IntPtr Constructor( [NullAllowed] string filename, RectangleF rect);
		
		[Export("initWithCGImage:")]
		IntPtr Constructor( [NullAllowed] CGImage image);
		
		#endregion
		
		#region Instance methods
		
		[Export("updateTransform")]
		void UpdateTransform();
		
		[Export("setTextureRect:")]
		void SetTextureRect(RectangleF rect);
		
		[Export("useSelfRender")]
		void UseSelfRender();
		
		[Export("useSpriteSheetRender:")]
		void UseSpriteSheetRender( [NullAllowed] SpriteSheet spriteSheet);
		
		#endregion
	}
	
	#endregion
	
	#region SpriteFrame
	
	[BaseType(typeof(NSObject), Name="CCSpriteFrame")]
	interface SpriteFrame
	{
		#region Static methods
		
		[Static, Export("frameWithTexture:rect:offset:")]
		SpriteFrame FrameWithTexture( [NullAllowed] Texture2D texture, RectangleF rect, PointF offset);
		
		[Static, Export("frameWithExture:rect:offset:originalSize:")]
		SpriteFrame FrameWithTexture( [NullAllowed] Texture2D texture, RectangleF rect, PointF offset, SizeF originalSize);
		
		#endregion
		
		#region Properties
		
		[Export("rect")]
		RectangleF Rect
		{
			get;
			set;
		}
		
		[Export("offset")]
		PointF Offset
		{
			get;
			set;
		}
		
		[Export("originalSize")]
		SizeF OriginalSize
		{
			get;
			set;
		}
		
		[NullAllowed, Export("texture", ArgumentSemantic.Retain)]
		Texture2D Texture
		{
			get;
			set;
		}
		
		#endregion
		
		#region Constructors
		
		[Export("initWithTexture:rect:offset:")]
		IntPtr Constructor( [NullAllowed] Texture2D texture, RectangleF rect, PointF offset);
		
		[Export("initWithTexture:rect:offset:originalSize:")]
		IntPtr Constructor( [NullAllowed] Texture2D texture, RectangleF rect, PointF offset, SizeF originalSize);
		
		#endregion
	}
	
	#endregion
	
	#region Animation
	
	[BaseType(typeof(NSObject), Name="CCAnimation")]
	interface Animation
	{
		#region Static methods
		
		[Static, Export("animationWithName:delay:")]
		Animation AnimationWithName( [NullAllowed] string name, float delay);
		
		[Static, Export("animationWithName:delay:frames:")]
		Animation AnimationWithName( [NullAllowed] string name, float delay, [NullAllowed] SpriteFrame[] frames);
		
		#endregion
		
		#region Properties
		
		[NullAllowed, Export("name", ArgumentSemantic.Retain)]
		string Name
		{
			get;
			set;
		}
		
		[Export("delay", ArgumentSemantic.Assign)]
		float Delay
		{
			get;
			set;
		}
		
		[NullAllowed, Export("frames", ArgumentSemantic.Retain)]
		SpriteFrame[] Frames
		{
			get;
			set;
		}
		
		#endregion
		
		#region Constructors
		
		[Export("initWithName:delay:")]
		IntPtr Constructor( [NullAllowed] string name, float delay);
		
		[Export("initWithName:delay:frames:")]
		IntPtr Constructor( [NullAllowed] string name, float delay, [NullAllowed] SpriteFrame[] frames);
		
		#endregion
		
		#region Instance methods
		
		[Export("addFrame:")]
		void AddFrame( [NullAllowed] SpriteFrame frame);
		
		[Export("addFrameWithFilename:")]
		void AddFrameWithFilename( [NullAllowed] string filename);
		
		[Export("addFrameWithTexture:rect:")]
		void AddFrameWithTexture( [NullAllowed] Texture2D texture, RectangleF rect);
		
		#endregion
	}
	
	#endregion
	
	#region TextureAtlas
	
	[BaseType(typeof(NSObject), Name="CCTextureAtlas")]
	interface TextureAtlas
	{
		#region Static methods
		
		[Static, Export("textureAtlasWithFile:capacity:")]
		TextureAtlas TextureAtlasWithFile( [NullAllowed] string file, uint capacity);
		
		[Static, Export("textureAtlasWithTexture:capacity:")]
		TextureAtlas TextureAtlasWithTexture( [NullAllowed] Texture2D tex, uint capacity);
		
		#endregion
		
		#region Properties
		
		[Export("totalQuads")]
		uint TotalQuads
		{
			get;
		}
		
		[Export("capacity")]
		uint Capacity
		{
			get;
		}
		
		[NullAllowed, Export("texture", ArgumentSemantic.Retain)]
		Texture2D Texture
		{
			get;
			set;
		}
		
		[NullAllowed, Export("quads", ArgumentSemantic.Assign)]
		[Internal]
		IntPtr Quads
		{
			get;
			set;
		}
		
		#endregion
		
		#region Constructors
		
		[Export("initWithFile:capacity:")]
		IntPtr Constructor( [NullAllowed] string file, uint capacity);
		
		[Export("initWithTexture:capacity:")]
		IntPtr Constructor( [NullAllowed] Texture2D tex, uint capacity);
		
		#endregion
		
		#region Instance methods
		
		[Export("updateQuad:atIndex:")]
		[Internal]
		void UpdateQuad( [NullAllowed] IntPtr quad, uint index);
		
		[Export("insertQuad:atIndex:")]
		[Internal]
		void InsertQuad( [NullAllowed] IntPtr quad, uint index);
		
		[Export("insertQuadFromIndex:atIndex:")]
		void InsertQuadFromIndex(uint fromIndex, uint newIndex);
		
		[Export("removeQuadAtIndex")]
		void RemoveQuadAtIndex(uint index);
		
		[Export("removeAllQuads")]
		void RemoveAllQuads();
		
		[Export("resizeCapacity:")]
		bool ResizeCapacity(uint n);
		
		[Export("drawNumberOfQuads:")]
		void DrawNumberOfQuads(uint n);
		
		[Export("drawQuads")]
		void DrawQuads();
		
		#endregion
	}
	
	#endregion
	
	#region SpriteSheet
	
	[BaseType(typeof(Node), Name="CCSpriteSheet")]
	interface SpriteSheet
	{
		#region Static methods
		
		[Static, Export("spriteSheetWithTexture:")]
		SpriteSheet SpriteSheetWithTexture( [NullAllowed] Texture2D tex);
		
		[Static, Export("spriteSheetWithTexture:capacity:")]
		SpriteSheet SpriteSheetWithTexture( [NullAllowed] Texture2D tex, uint capacity);
		
		[Static, Export("spriteSheetWithFile:")]
		SpriteSheet SpriteSheetWithFile( [NullAllowed] string fileImage);
		
		[Static, Export("spriteSheetWithFile:capacity:")]
		SpriteSheet SpriteSheetWithFile( [NullAllowed] string fileImage, uint capacity);
		
		#endregion
		
		#region Properties
		
		[NullAllowed, Export("textureAtlas", ArgumentSemantic.Retain)]
		TextureAtlas TextureAtlas
		{
			get;
			set;
		}
		
		[Export("blendFunc")]
		BlendFunc BlendFunc
		{
			get;
			set;
		}
		
		#endregion
		
		#region Constructors
		
		[Export("initWithTexture:capacity:")]
		IntPtr Constructor( [NullAllowed] Texture2D tex, uint capacity);
		
		[Export("initWithFile:capacity:")]
		IntPtr Constructor( [NullAllowed] string fileImage, uint capacity);
		
		#endregion
		
		#region Instance methods
		
		[Export("increaseAtlasCapacity")]
		void IncreaseAtlasCapacity();
		
		[Export("createSpriteWithRect:")]
		Sprite CreateSpriteWithRect(RectangleF rect);
		
		[Export("initSprite:rect:")]
		void InitSprite( [NullAllowed] Sprite sprite, RectangleF rect);
		
		[Export("removeChildAtIndex:cleanup:")]
		void RemoveChildAtIndex(uint index, bool doCleanup);
		
		[Export("removeChild:cleanup:")]
		void RemoveChild( [NullAllowed] Sprite sprite, bool doCleanup);
		
		[Export("insertChild:inAtlasAtIndex:")]
		void InsertChild( [NullAllowed] Sprite child, uint index);
		
		[Export("removeSpriteFromAtlas:")]
		void RemoveSpriteFromAtlas( [NullAllowed] Sprite sprite);
		
		[Export("rebuildIndexInOrder:atlasIndex:")]
		uint RebuildIndexInOrder( [NullAllowed] Sprite parent, uint index);
		
		[Export("atlasIndexForChild:atZ:")]
		uint AtlasIndexForChild( [NullAllowed] Sprite parent, int z);
		
		#endregion
	}
	
	#endregion
	
	#region Layer
	
	[BaseType(typeof(Node), Name="CCLayer")]
	interface Layer
	{
		[Export("isTouchEnabled", ArgumentSemantic.Assign)]
		bool IsTouchEnabled
		{
			get;
			set;
		}
		
		[Export("isAccelerometerEnabled", ArgumentSemantic.Assign)]
		bool IsAccelerometerEnabled
		{
			get;
			set;
		}
		
		[Export("registerWithTouchDispatcher")]
		void RegisterWithTouchDispatcher();
	}
	
	#endregion
	
	#region Node
	
	[BaseType(typeof(NSObject), Name="CCNode")]
	interface Node
	{
		#region Properties
		
		[Export("zOrder")]
		int ZOrder
		{
			get;
		}
		
		[Export("vertexZ")]
		float VertexZ
		{
			get;
			set;
		}
		
		[Export("rotation", ArgumentSemantic.Assign)]
		float Rotation
		{
			get;
			set;
		}
		
		[Export("scale", ArgumentSemantic.Assign)]
		float Scale
		{
			get;
			set;
		}
		
		[Export("scaleX", ArgumentSemantic.Assign)]
		float ScaleX
		{
			get;
			set;
		}
		
		[Export("scaleY", ArgumentSemantic.Assign)]
		float ScaleY
		{
			get;
			set;
		}
		
		[Export("position", ArgumentSemantic.Assign)]
		PointF Position
		{
			get;
			set;
		}
		
		[NullAllowed, Export("camera")]
		Camera Camera
		{
			get;
		}
		
		[NullAllowed, Export("grid", ArgumentSemantic.Retain)]
		GridBase Grid
		{
			get;
			set;
		}
		
		[Export("visible", ArgumentSemantic.Assign)]
		bool Visible
		{
			get;
			set;
		}
		
		[Export("anchorPoint")]
		PointF AnchorPoint
		{
			get;
			set;
		}
		
		[Export("anchorPointInPixels")]
		PointF AnchorPointInPixels
		{
			get;
		}
		
		[Export("contentSize")]
		SizeF ContentSize
		{
			get;
			set;
		}
		
		[NullAllowed, Export("parent", ArgumentSemantic.Assign)]
		Node Parent
		{
			get;
			set;
		}
		
		[Export("relativeAnchorPoint", ArgumentSemantic.Assign)]
		bool RelativeAnchorPoint
		{
			get;
			set;
		}
		
		[Export("tag", ArgumentSemantic.Assign)]
		int Tag
		{
			get;
			set;
		}
		
		[NullAllowed, Export("userData", ArgumentSemantic.Assign)]
		IntPtr UserData
		{
			get;
			set;
		}
		
		#endregion
		
		#region Static methods
		
		// TODO:
		// calling WhateverNode.Node doesn't return an instance of WhateverNode
		// but still rather Node
		/*[Static, Export("node")]
		Node Node
		{
			get;
		}*/
		
		#endregion
		
		#region Instance methods
		
		[Export("onEnter")]
		void OnEnter();
		
		[Export("onEnterTranisitionDidFinish")]
		void OnEnterTransitionDidFinish();
		
		[Export("onExit")]
		void OnExit();
		
		[Export("addChild:")]
		Node AddChild( [NullAllowed] Node node);
		
		[Export("addChild:z:")]
		Node AddChild( [NullAllowed] Node node, int z);
		
		[Export("addChild:z:tag:")]
		Node AddChild( [NullAllowed] Node node, int z, int tag);
		
		[Export("removeChild:cleanup:")]
		void RemoveChild( [NullAllowed] Node node, bool cleanup);
		
		[Export("removeChildByTag:cleanup:")]
		void RemoveChildByTag(int tag, bool cleanup);
		
		[Export("removeAllChildrenWithCleanup:")]
		void RemoveAllChildrenWithCleanup(bool cleanup);
		
		[Export("getChildByTag:")]
		Node GetChildByTag(int tag);
		
		[Export("children")]
		Node[] Children
		{
			get;
		}
		
		[Export("reorderChild:z:")]
		void ReorderChild( [NullAllowed] Node child, int z);
		
		[Export("cleanup")]
		void Cleanup();
		
		[Export("draw")]
		void Draw();
		
		[Export("visit")]
		void Visit();
		
		[Export("transform")]
		void Transform();
		
		[Export("transformAncestors")]
		void TransformAncestors();
		
		[Export("boundingBox")]
		RectangleF BoundingBox
		{
			get;
		}
		
		[Export("runAction:")]
		Action RunAction( [NullAllowed] Action action);
		
		[Export("stopAllActions")]
		void StopAllActions();
		
		[Export("stopAction:")]
		void StopAction(Action action);
		
		[Export("stopActionByTag:")]
		void StopActionByTag(int tag);
		
		[Export("getActionByTag:")]
		Action GetActionByTag(int tag);
		
		[Export("numberOfRunningActions")]
		int NumberOfRunningActions
		{
			get;
		}
		
		[Export("schedule:")]
		void Schedule(Selector sel);
		
		[Export("schedule:interval:")]
		void Schedule(Selector sel, float interval);
		
		[Export("schedule:repeat:")]
		void Schedule(Selector sel, int times);
		
		[Export("schedule:interval:repeat:")]
		void Schedule(Selector sel, float interval, int times);
		
		[Export("unschedule:")]
		void Unschedule(Selector sel);
		
		[Export("activateTimers")]
		void ActivateTimers();
		
		[Export("deactivateTimers")]
		void DeactivateTimers();
		
		[Export("nodeToParentTransform")]
		CGAffineTransform NodeToParentTransform
		{
			get;
		}
		
		[Export("parentToNodeTransform")]
		CGAffineTransform ParentToNodeTransform
		{
			get;
		}
		
		[Export("nodeToWorldTransform")]
		CGAffineTransform NodeToWorldTransform
		{
			get;
		}
		
		[Export("worldToNodeTransform")]
		CGAffineTransform WorldToNodeTransform
		{
			get;
		}
		
		[Export("convertToNodeSpace:")]
		PointF ConvertToNodeSpace(PointF worldPoint);
		
		[Export("convertToWorldSpace:")]
		PointF ConvertToWorldSpace(PointF nodePoint);
		
		[Export("convertToNodeSpaceAR:")]
		PointF ConvertToNodeSpaceAR(PointF worldPoint);
		
		[Export("convertToWorldSpaceAR:")]
		PointF ConvertToWorldSpaceAR(PointF nodePoint);
		
		[Export("convertTouchToNodeSpace:")]
		PointF ConvertTouchToNodeSpace(UITouch touch);
		
		[Export("convertTouchToNodeSpaceAR:")]
		PointF ConvertTouchToNodeSpaceAR(UITouch touch);
		
		#endregion
	}
	
	#endregion
	
	#region Scene
	
	[BaseType(typeof(Node), Name="CCScene")]
	interface Scene
	{
	}
	
	#endregion
	
	#region Director
	
	[BaseType(typeof(NSObject), Name="CCDirector")]
	interface Director
	{
		#region Properties
		
		[NullAllowed, Export("loadingBundle", ArgumentSemantic.Assign)]
		NSBundle LoadingBundle
		{
			get;
			set;
		}
		
		[Export("runningScene")]
		Scene RunningScene
		{
			get;
		}
		
		[Export("animationInterval", ArgumentSemantic.Assign)]
		double AnimationInterval
		{
			get;
			set;
		}
		
		[Export("displayFPS", ArgumentSemantic.Assign)]
		bool DisplayFPS
		{
			get;
			set;
		}
		
		[Export("pixelFormat")]
		PixelFormat PixelFormat
		{
			get;
		}
		
		[Export("nextDeltaTimeZero", ArgumentSemantic.Assign)]
		bool NextDeltaTimeZero
		{
			get;
			set;
		}
		
		[Export("deviceOrientation")]
		DeviceOrientation DeviceOrientation
		{
			get;
			set;
		}
		
		[Export("isPaused")]
		bool IsPaused
		{
			get;
		}
		
		[Export("projection")]
		DirectorProjection Projection
		{
			get;
			set;
		}
		
		#endregion
		
		#region Static Methods
		
		[Static, Export("sharedDirector")]
		Director SharedDirector
		{
			get;
		}
		
		[Static, Export("setDirectorType:")]
		bool SetDirectorType(DirectorType type);
		
		#endregion
		
		#region Instance Methods
		
		[Export("setPixelFormat:")]
		void SetPixelFormat(PixelFormat format);
		
		[Export("setDepthBufferFormat:")]
		void SetDepthBufferFormat(DepthBufferFormat format);
		
		[Export("detach")]
		bool Detach();
		
		[Export("attachInWindow:")]
		bool AttachInWindow( [NullAllowed] UIWindow window);
		
		[Export("attachInView:")]
		bool AttachInView( [NullAllowed] UIView view);
		
		[Export("attachInView:withFrame:")]
		bool AttachInView( [NullAllowed] UIView view, RectangleF frame);
		
		[Export("winSize")]
		SizeF WindowSize
		{
			get;
		}
		
		[Export("displaySize")]
		SizeF DisplaySize
		{
			get;
		}
		
		[Export("convertToGL:")]
		PointF ConvertToGL(PointF p);
		
		[Export("convertToUI:")]
		PointF ConvertToUI(PointF p);
		
		[Export("runWithScene:")]
		void RunWithScene( [NullAllowed] Scene scene);
		
		[Export("pushScene:")]
		void PushScene( [NullAllowed] Scene scene);
		
		[Export("popScene")]
		void PopScene();
		
		[Export("replaceScene:")]
		void ReplaceScene( [NullAllowed] Scene scene);
		
		[Export("end")]
		void End();
		
		[Export("pause")]
		void Pause();
		
		[Export("resume")]
		void Resume();
		
		[Export("stopAnimation")]
		void StopAnimation();
		
		[Export("startAnimation")]
		void StartAnimation();
		
		#endregion
	}
	
	#endregion
}
